package com.example.demo.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.domain.entity.VojProblemTags;
import com.example.demo.param.voj.VojCategorySaveParam;
import com.example.demo.param.voj.VojTagSaveParam;
import com.example.demo.service.VojProblemTagsService;
import com.example.demo.mapper.VojProblemTagsMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
* @author 00774904
* @description 针对表【voj_problem_tags】的数据库操作Service实现
* @createDate 2023-12-09 14:29:51
*/
@Service
public class VojProblemTagsServiceImpl extends ServiceImpl<VojProblemTagsMapper, VojProblemTags>
    implements VojProblemTagsService{

    @Resource
    private VojProblemTagsMapper vojProblemTagsMapper;

    @Override
    public void save(VojTagSaveParam param) {
        VojProblemTags entity = BeanUtil.copyProperties(param, VojProblemTags.class);
        if (null == param.getId()){
            // 新增
            vojProblemTagsMapper.insert(entity);
        }else {
            // 编辑
            entity.setProblemTagId(param.getId());
            vojProblemTagsMapper.updateById(entity);
        }
    }
}




